<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8" />
        <title>16_深拷贝-json</title>
    </head>
    <body>
        <script>
            // JSON.stringify   对象--》string
            // JSON.parse       string--》对象

            var obj = {
                a1name:'zs',
                a2age:18,
                a3gender:true,
                a4un:undefined,
                a5n:null,
                a6arr:['1','2','3'],
                a7fun:function(){
                    console.log(1111);
                },
                a8obj:{
                    name:'ls'
                },
                a9reg:/\w{6,8}/
            }


            var obj1 = JSON.parse(JSON.stringify(obj));

            // console.log(obj);
            // console.log(obj1);

            obj.a6arr[1] = 666;
            console.log(obj);
            console.log(obj1);

        </script>
    </body>
</html>